package pers.echo.tester.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import pers.echo.tester.entity.TblCkqinfo;
import pers.echo.tester.enums.ResTypeEnum;
import pers.echo.tester.mapper.TblCkqinfoMapper;
import pers.echo.tester.service.ITblCkqinfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import pers.echo.tester.service.ITblTkqinfoService;

import java.time.LocalDateTime;

/**
 * <p>
 * ?????? 服务实现类
 * </p>
 *
 * @author jobob
 * @since 2020-09-17
 */
@Service
public class TblCkqinfoServiceImpl extends ServiceImpl<TblCkqinfoMapper, TblCkqinfo> implements ITblCkqinfoService {

    @Autowired
    ITblCkqinfoService ckqinfoService;

    @Autowired(required = false)
    TblCkqinfoMapper mapper;

    @Override
    public TblCkqinfo getCkqinfoTemplate() {
        TblCkqinfo ckqinfo = mapper.getFirstCkqinfo();
        if(ckqinfo!=null){
            ckqinfo.setBulletinid(null);
            ckqinfo.setCkqinfoid(null);
            ckqinfo.setFNo(null);

            LocalDateTime beginTime = LocalDateTime.now();
            LocalDateTime bailTime = beginTime.plusDays(10);
            LocalDateTime startTime = beginTime.plusDays(20);
            LocalDateTime closeTime = beginTime.plusDays(30);

            ckqinfo.setFBeigintime(startTime);
            ckqinfo.setFClosetime(closeTime);
            ckqinfo.setFFinishtime(closeTime);
            ckqinfo.setLastfixtime(beginTime);
            ckqinfo.setCreatedtime(beginTime);
            ckqinfo.setFBailtime(bailTime);

            ckqinfo.setFStatuscode("K");
            return ckqinfo;
        }
        return null;
    }
}
